import RequestUtils from '@/utils/RequestUtils'

const groupName = 'activiti'
const apiName = 'task'

export default {
  /**
   * 签收任务
   * @param taskId
   * @returns {AxiosPromise}
   */
  claim(taskId) {
    return RequestUtils({
      url: `/${groupName}/${apiName}/claim/${taskId}`,
      method: 'PUT'
    })
  },
  /**
   * 委派任务
   * @param taskId
   * @returns {AxiosPromise}
   */
  delegate(taskId) {
    return RequestUtils({
      url: `/${groupName}/${apiName}/delegate/${taskId}`,
      method: 'PUT'
    })
  },
  /**
   * 回退任务
   * @param taskId
   * @returns {AxiosPromise}
   */
  back(taskId) {
    return RequestUtils({
      url: `/${groupName}/${apiName}/back/${taskId}`,
      method: 'PUT'
    })
  }
}
